import { Inject } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { NurseInfoEntity } from '../../entity/info';
import { NurseInfoService } from '../../service/info';
import { BaseSysUserEntity } from '../../../base/entity/sys/user';

/**
 * 护士信息控制器
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: NurseInfoEntity,
  service: NurseInfoService,
  pageQueryOp: {
    // keyWordLikeFields: ['a.name', 'a.workNo'],
    fieldEq: ['a.title', 'a.status'],
    select: [],
    // join: [
    //   // {
    //   //   entity: BaseSysUserEntity,
    //   //   alias: 'b',
    //   //   condition: 'a.userId = b.id',
    //   //   type: 'leftJoin',
    //   // },
    // ],
    // where: ctx => {
    //   // const { entryDate } = ctx.request.body;
    //   // const where = [];
    //   // if (entryDate && entryDate.length === 2) {
    //   //   where.push([
    //   //     'a.entryDate BETWEEN :start AND :end',
    //   //     { start: entryDate[0], end: entryDate[1] },
    //   //   ]);
    //   // }
    //   return where;
    // },
  },
})
export class AdminNurseInfoController extends BaseController {
  @Inject()
  nurseInfoService: NurseInfoService;
}
